package com.souche.employment.mapper;

import com.souche.employment.domain.JobEntryDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * userMapper.java created at 2017年8月9日 下午2:23:36
 *
 * @author Ray [email:rayinhangzhou@hotmail.com]
 * Revision History
 * Date            Programmer                   Notes
 * ----------------------------------------------------------
 **/
@Mapper
public interface JobEntryMapper {

    @Select("select * from job_entry where employee_id = #{employeeId}")
    JobEntryDO getJobEntryByEmployeeId(String employeeId);

    @Insert("insert into job_entry (id, employee_id, name, phone, job_id, current, expect, salary, checkin, team, memo, date_create) values(" +
            "#{id}, #{employeeId}, #{name}, #{phone}, #{jobId}, #{current}, #{expect}, #{checkin}, #{team}, #{memo}, now())")
    void add(JobEntryDO jobEntryDO);

    @Update("update job_entry set date_delete= unix_timestamp(now()) where id=#{id}")
    void delete(String id);

//    @SelectProvider(type = SqlProvider.class, method = "findJobEntry")
//    @Results({
//            @Result(property = "employeeId", column = "employee_id"),
//            @Result(property = "jobId", column = "job_id"),
//            @Result(property = "dateCreate", column = "date_create"),
//            @Result(property = "dateUpdate", column = "date_update")
//    })
//    List<JobEntryDO> search(@Param("name") String name, @Param("phone") String phone,
//                            @Param("checkin0") String checkin0, @Param("checkin1") String checkin1);


}
